<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Logowanie</title>
</head>
<body>
<form name="myform" action="/lute/login" method="POST">
  Username: <input type="text" id="user" name="username"/><br/>
  Password: <input type="password" id="pass" name="password"/>
  <input type="submit" id="login" value="Login"/>
</form>

<script type="text/javascript">
  var login=$('#user').val(), password_hash=$('#pass').val();
  $('login').bind('click', function() {
    $.ajax('http://localhost:8080/lute/login', {
      type: 'POST',
      contentType: 'application/json',
      data: JSON.stringify({username:login, password:password_hash}),
      complete: function() { /* Do something with the response. */ }
    });
    return false; // Prevent form submit.
  });
</script>
</body>
</html>